/**
 * Created by Administrator on 2017/11/2.
 */
import Vue from 'vue'
import Vuex from 'vuex'
import * as actions from './actions'
import * as getters from './getters'
import state from './state'
import mutations from './mutations'
import createLogger from 'vuex/dist/logger'

/* 每次修改state会打印一个log */
Vue.use(Vuex)

/* 检测是否是通过mutations改变的state */
/* 开发环境下dev */
const debug = process.env.NODE_ENV !== 'production'

export default new Vuex.Store({
  actions,
  getters,
  state,
  mutations,
  strict: debug,
  plugins: debug ? [createLogger()] : []
})
